package com.hfast.fakenotification;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * Created by Carl on 2014-07-30.
 */
public class TextMessage {

    private String[] messages;
    private String sender;
    private String recentMessage;
    private String date;
    private DateFormat df = new SimpleDateFormat("h:mm a");

    public TextMessage (String sender, String message){
        this.sender = sender;
        messages = new String[20];
        messages[0] = message;
        recentMessage = message;
        date = df.format(Calendar.getInstance().getTime());
    }

    public void addMessage(String newMessage){
        int i;
        for (i = 0 ; i<messages.length ; i++){
            if(messages[i] == null){
                messages[i] = newMessage;
            }
        }
        recentMessage = newMessage;
        date = df.format(Calendar.getInstance().getTime());
    }

    public String getSender(){
        return sender;
    }

    public String[] getAllMessages(){
        return messages;
    }

    public String getRecentMessage(){
        return recentMessage;
    }

    public String getDate(){
        return date;
    }

}
